---
id: 660f530d6e33d159e1bf4947
title: Step 106
challengeType: 1
dashedName: step-106
---

# --description--

Sometimes you will want to run different code when an `if` condition is false. You can do this by adding an `else` block. An `else` block will only evaluate if the `if` block does not evaluate.

The syntax to add an `else` block is:

```js
if (condition) {
  logic
} else {
  logic
}
```

Add an `else` block to your `if` block.

# --hints--

You should add an `else` block.

```js
assert.match(code, /if\s*\(\s*inverted\s*\)\s*\{\s*rows\.unshift\(\s*padRow\(\s*i\s*,\s*count\s*\)\s*\);\s*\}\s*else\s*\{/);
```

Your `else` block should be empty.

```js
assert.match(code, /if\s*\(\s*inverted\s*\)\s*\{\s*rows\.unshift\(\s*padRow\(\s*i\s*,\s*count\s*\)\s*\);\s*\}\s*else\s*\{\s*\}/);
```

# --seed--

## --seed-contents--

```js
const character = "#";
const count = 8;
const rows = [];
let inverted = true;

function padRow(rowNumber, rowCount) {
  return " ".repeat(rowCount - rowNumber) + character.repeat(2 * rowNumber - 1) + " ".repeat(rowCount - rowNumber);
}

// TODO: use a different type of loop
--fcc-editable-region--
for (let i = 1; i <= count; i++) {
  if (inverted) {
    rows.unshift(padRow(i, count));
  }

}
--fcc-editable-region--

/*while (rows.length < count) {
  rows.push(padRow(rows.length + 1, count));
}*/

/*for (let i = count; i > 0; i--) {
  rows.push(padRow(i, count));
}*/

let result = ""

for (const row of rows) {
  result = result + "\n" + row;
}

console.log(result);
```
